1. Technical Field
This disclosure relates generally to computer processors, and more particularly to storage and manipulation of numbers within processors.
2. Description of the Related Art
Computing elements use many formats to represent numbers (e.g., in memory). One type of number formats used by computing element is “floating-point”; another is “fixed-point.” Floating-point formats are commonly used, for example, in scientific applications involving a large range of numbers (i.e. involving very small and/or very large numbers), while fixed-point may be used for applications where the range of numbers is relatively small.
There are various floating-point standards, which may represent the following attributes of a number: sign, significand (also referred to as the “mantissa”), and exponent. A floating-point number can be represented as follows: mantissa×baseexponent (a sign bit may also be included, indicating whether the number is positive or negative). Accordingly, for binary (base 2), this formula is mantissa×2exponent For example, the number 2 may be represented in binary floating-point using a sign bit of zero (to indicate a positive number), an exponent value of 1, and a mantissa value of 1 (1×21=2). The values for the mantissa and exponent fields may have special encodings. For example a leading bit of “1” for the mantissa is often implied, and the exponent field is usually biased so that it can be read as an unsigned number. As opposed to fixed-point representation, the decimal point in floating-point representation can “float” anywhere within the bits of the mantissa.
A given floating-point standard may specify different “precisions,” a term used to refer to the number of bits used to represent numbers. For example, the IEEE 754 standard defines four precisions of binary floating-point numbers using 16, 32, 64, and 128 bits. Each IEEE precision uses different numbers of bits to represent mantissa and exponent values of a number. In some cases, a floating-point instruction may specify that the result of a particular floating-point instruction is to be stored in memory using a particular precision.
Computing elements using floating-point numbers (such as graphics processing units (GPUs)) are often designed for performance, with little regard for power consumption. Typically, computation involving floating-point numbers is performed at the highest precision supported by a processing unit; results are then converted to a lower precision if a lower precision is required. Furthermore, floating-point numbers are often stored by a processing unit using a largest precision supported by the processing unit, regardless of the actual precision of the number. In these scenarios, a floating-point number stored using one type of precision is read from memory using that type of precision before it can be converted to another type of precision.